﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ZhaJinHua.Data.Entities;

namespace ZhaJinHua.Mvc.Web
{
    public class WorkContext
    {
        private HttpContextBase _httpContext;

        public WorkContext(HttpContextBase httpContext)
        {
            _httpContext = httpContext;
        }

        private UserInfo userInfo;
        public UserInfo CurrentUser
        {
            get
            {
                if(userInfo==null)
                    userInfo = _httpContext.Session["CurrentUser"] as UserInfo;
                return userInfo;
            }
            set
            {
                _httpContext.Session["CurrentUser"] = value;
                userInfo = value;
            }
        }
    }
}